import React, { Component } from 'react';
import { Link } from 'react-router';
import { inject, observer } from 'mobx-react';
import { Toast, ListView, Picker, Flex, InputItem } from 'antd-mobile'
import { createForm } from 'rc-form';
import Top from 'components/top'
import Ajax from 'lib/Ajax'
import List from 'mixin/list'

@inject('appStore', 'languageStore')
@observer
class ModuleName extends List {
  constructor(props) {
    super(props);
    this.listApi = '/teacher/list'
  }

  // componentDidMount(){
  //   this.fetchSchool(1)
  // }

  renderRow = (rowData, sectionID, rowID)=>{
    const { imgBaseUrl, commonData } = this.props.appStore;
    return (
        <div key={rowID} className="activity-item">
          <Link to={`/teacher/${rowData.teacherId}`}>
            <img src={`${imgBaseUrl}${rowData.coverImg}`} alt=""/>
            <div className="row-text">
              <div className="t">{rowData.name}</div>
              <div className="b">
                专长国家:{rowData.expertise}
								<span className="fr">{rowData.consultCount}人咨询</span>
              </div>
            </div>
          </Link>
        </div>
      );
  }

  render() {
    const pageData = this.props.languageStore.getPageData('teacher');

    const { imgBaseUrl, commonData } = this.props.appStore;

    return (
      <div className="teacher">
        <Top
          title={pageData.title}
        />
        <div className="teacher-con">
          <div className="list">
            <ListView ref="lv"
              dataSource={this.state.dataSource}
              renderFooter={this.renderFooter}
              renderRow={this.renderRow}
              className="fortest"
              pageSize={4}
              scrollRenderAheadDistance={500}
              scrollEventThrottle={20}
              onScroll={() => { console.log('scroll'); }}
              onEndReached={this.onEndReached}
              onEndReachedThreshold={10}
              stickyHeader
            />
          </div>
        </div>
      </div>
    )
  }
}


module.exports = ModuleName
